from flask_caching import Cache
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from flask_redis import FlaskRedis
from flask_pymongo import PyMongo
mongo = PyMongo()
db = SQLAlchemy()
migrate = Migrate()
cache = Cache(config={
    "CACHE_TYPE": "redis",
})

redis = FlaskRedis(decode_responses=True)  # utf-8 格式显示  不要显示二进制


def init_ext(app):
    db.init_app(app)
    mongo.init_app(app)
    migrate.init_app(app, db)
    cache.init_app(app=app)
    redis.init_app(app)
